package dao;

import vo.Furniture;
import vo.Sale;
import vo.Warehousing;

import java.util.List;

public class WarehousingDaoimpl extends BaseDao implements IWarehousing{//对入库表操作的具体实现类
    @Override
    public boolean add(Warehousing warehousing) {
        String sql="insert into warehousing values(?,?,?);";  //添加
        return update(sql,warehousing.getFurniture_id(),warehousing.getCount(),warehousing.getTime());
    }

    @Override
    public boolean delete(Warehousing warehousing) {
        String sql="delet from warehousing where furniture_id=?";//通过id删除
        return update(sql,warehousing.getFurniture_id());
    }

    @Override
    public boolean modify(Warehousing warehousing) {
        String sql="update warehousing set furniture_id=?,count=?,time=? where furniture_id=?";// 传入一个修改后的销售表信息,通过修后的id来找到对应的信息
        return update(sql,warehousing.getFurniture_id(),warehousing.getCount(),warehousing.getTime());
    }

    @Override
    public Warehousing getcustombyid(String id) {
        String sql="select*from sale where id=?";
        return getInstance(Warehousing.class,sql,id);//按照id查询
    }

    @Override
    public List<Warehousing> getall() {
        String sql="select*from custom";
        List<Warehousing> list=getList(Warehousing.class,sql);//查询到的所有信息
        return list;
    }
}
